package com.example.recyclerviewdemo.demo0.adapter

import android.view.View
import android.view.ViewGroup
import com.chad.library.adapter.base.loadmore.BaseLoadMoreView
import com.chad.library.adapter.base.loadmore.LoadMoreStatus
import com.chad.library.adapter.base.util.getItemView
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.recyclerviewdemo.R


/**
 * 自定义加载更多布局
 * */
class CustomLoadMoreView : BaseLoadMoreView() {

    override fun getLoadComplete(holder: BaseViewHolder): View = holder.getView(R.id.loadComplete)

    override fun getLoadEndView(holder: BaseViewHolder): View = holder.getView(R.id.loadEnd)

    override fun getLoadFailView(holder: BaseViewHolder): View = holder.getView(R.id.loadError)

    override fun getLoadingView(holder: BaseViewHolder): View = holder.getView(R.id.loadIng)

    override fun getRootView(parent: ViewGroup): View {
        return parent.getItemView(R.layout.rv_load_state)
        //return LayoutInflater.from(parent.context).inflate(R.layout.complete, parent, false)
    }

    override fun convert(holder: BaseViewHolder, position: Int, loadMoreStatus: LoadMoreStatus) {
        super.convert(holder, position, loadMoreStatus)
        when (loadMoreStatus) {
            LoadMoreStatus.Complete -> {

            }
            LoadMoreStatus.Loading -> {

            }
            LoadMoreStatus.Fail -> {

            }
            LoadMoreStatus.End -> {

            }
        }
    }
}